<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="sosr.bean.Medecin"%>
<%@page import="sosr.serveur.IServeurRMI"%>
<%@page import="java.util.Iterator"%>
<%@page import="sosr.bean.Patient"%>
<%@page import="java.util.ArrayList"%>
<jsp:useBean id="logon" scope="session" class="bean.Connexion"></jsp:useBean>
<%
IServeurRMI serv = logon.getSrvRMI();
serv.open();

ArrayList<Medecin> ar = serv.listMedecin();

serv.close();

String info_isadmin = "";

int i = 0;
Iterator<Medecin> it = ar.iterator();
%>

<h1>Liste des utilisateurs</h1>
<%
while (it.hasNext()) { 
	i++;
	Medecin p =it.next();
	String color = "#edf2ff";
	if (i%2 == 0) color = "#ffffff";
	if (p.getId()==0) info_isadmin = "<strong>[admin]</strong>";
	else info_isadmin = "";
%>
<div style="background: <%=color %>; width: 100%" class="ln-rm" xrm="<%=i %>" id="ln-rm-<%=i %>" idp="<%=p.getId() %>" >
	<div onclick="setAction('view_user',<%=p.getId() %>,false); hilightme('ln-rm-<%=i %>','ln-rm');">
		<div class="idp_name"><%=p.getNom() %></div>
		<div><%=p.getPrenom() %> <%=info_isadmin %></div>
	</div>
	<div class="_bu" id="rm-p-<%=i %>" style="display: none">
	<div class="view_bu" title="Consulter la fiche de l'utilisateur"
		onclick="setAction('view_user',<%=p.getId() %>,false); hilightme('ln-rm-<%=i %>','ln-rm');"></div>
	<div class="edit_bu" title="Editer la fiche de l'utilisateur" 
		onclick="setAction('edit_user',<%=p.getId() %>,false); hilightme('ln-rm-<%=i %>','ln-rm'); hilightmenu('mb8');"></div>
	<div class="close_bu" title="Supprimer l'utilisateur"
		onclick="warn('drop_user',<%=p.getId() %>,'<%=p.getPrenom()+" "+p.getNom() %>',true); hilightme('ln-rm-<%=i %>','ln-rm');"></div>
	</div>
</div>
<%
}

%>
<script type="text/javascript">
$(".ln-rm").mouseover(function() {
	$("._bu").hide();
	var i = $(this).attr("xrm");
	$("#rm-p-"+i).show();
});
</script>